package com.unlcn.erp.hyc.interfaces.api.controller;

import cn.huiyunche.commons.domain.ResultDTO;
import cn.huiyunche.commons.exception.BusinessException;
import com.unlcn.erp.hyc.interfaces.backend.service.CallPayCodesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by zoupx on 2017-09-08.
 */

@Controller
@RequestMapping("/callPayCodes")
public class CallPayCodesController {

    private static final Logger LOGGER = LoggerFactory.getLogger(CallPayCodesController.class);

    @Autowired
    private CallPayCodesService callPayCodesService;

    @RequestMapping(value = "/savePayCodes" ,method = RequestMethod.GET)
    @ResponseBody
    public void saveOrderByHYC(){
        LOGGER.info("CallPayCodesController.savePayCodes param:{}.");
        ResultDTO<Object> result = new ResultDTO<Object>(true, null, "查询成功");
        try{
            callPayCodesService.getPayCodes();
        }catch (Exception e){
            LOGGER.error("TmsPickUpController.getExcepList error: {}", e);
            throw new BusinessException(e);
        }
    }


    @RequestMapping(value = "/updateArpayship" ,method = RequestMethod.GET)
    @ResponseBody
    public void updateArorder(){
        LOGGER.info("CallPayCodesController.updateArorder param:{}.");
        ResultDTO<Object> result = new ResultDTO<Object>(true, null, "查询成功");
        try{
            callPayCodesService.updateArpayship();
        }catch (Exception e){
            LOGGER.error("TmsPickUpController.getExcepList error: {}", e);
            throw new BusinessException(e);
        }
    }

    @RequestMapping(value = "/markersOfBill" , method = RequestMethod.GET)
    @ResponseBody
    public void markersOfBill(){
        LOGGER.info("CallPayCodesController.markersOfBill param:{}");
        ResultDTO<Object> result = new ResultDTO<Object>(true, null, "查询成功");
        try{
            callPayCodesService.markersOfBill();
        }catch (Exception e){
            LOGGER.error("CallPayCodesController.markersOfBill error: {}", e);
            throw new BusinessException(e);
        }
    }

    @RequestMapping(value = "/paymentAmount" , method = RequestMethod.GET)
    @ResponseBody
    public void paymentAmount(){
        LOGGER.info("CallPayCodesController.paymentAmount param:{}");
        ResultDTO<Object> result = new ResultDTO<Object>(true, null, "查询成功");
        try{
            callPayCodesService.paymentAmount();
        }catch (Exception e){
            LOGGER.error("CallPayCodesController.paymentAmount error: {}", e);
            throw new BusinessException(e);
        }
    }


}
